home *** CD-ROM | disk | FTP | other *** search
- on DoButtonHit style, targetSprite, inCast, outCast, inCmd, outCmd, whileDownCmd, soundDown, soundUp, simClick
- if stringp(inCast) then
- set inCast to the number of member inCast
- end if
- if stringp(outCast) then
- set outCast to the number of member outCast
- end if
- if stringp(soundDown) then
- set soundDown to the number of member soundDown
- end if
- if stringp(soundUp) then
- set soundUp to the number of member soundUp
- end if
- if style = #be_pushButton then
- set style to 0
- else
- if style = #be_toggleButton then
- set style to 1
- else
- if style = #be_radioButton then
- set style to 2
- else
- if symbolp(style) then
- set style to -1
- end if
- end if
- end if
- end if
- if (style < 0) or (style > 2) then
- return
- end if
- if (style = 2) or (the castNum of sprite targetSprite = outCast) then
- set theInCast to inCast
- set theOutCast to outCast
- else
- set theInCast to outCast
- set theOutCast to inCast
- end if
- if (style = 2) and (the castNum of sprite targetSprite = inCast) then
- exit
- end if
- if soundDown > 0 then
- puppetSound(1, soundDown)
- end if
- puppetSprite(targetSprite, 1)
- set fastClick to 0
- if the stillDown then
- repeat while the mouseDown
- if rollOver(targetSprite) = 0 then
- set the castNum of sprite targetSprite to theOutCast
- else
- set the castNum of sprite targetSprite to theInCast
- if whileDownCmd <> EMPTY then
- do(whileDownCmd)
- end if
- end if
- updateStage()
- end repeat
- else
- if simClick or (the lastClick < 30) then
- set fastClick to 1
- set the castNum of sprite targetSprite to theInCast
- updateStage()
- startTimer()
- repeat while the timer < 15
- end repeat
- end if
- end if
- if (soundDown > 0) and (soundUp > 0) then
- sound stop 1
- end if
- if (rollOver(targetSprite) = 1) or fastClick then
- if soundUp > 0 then
- puppetSound(1, soundUp)
- end if
- if fastClick and (whileDownCmd <> EMPTY) then
- do(whileDownCmd)
- end if
- set releaseWithInCast to the castNum of sprite targetSprite = inCast
- if style = 0 then
- set the castNum of sprite targetSprite to theOutCast
- updateStage()
- else
- if style = 1 then
- end if
- end if
- if releaseWithInCast then
- do(inCmd)
- else
- do(outCmd)
- end if
- else
- if style = 0 then
- set the castNum of sprite targetSprite to theOutCast
- updateStage()
- end if
- end if
- return releaseWithInCast
- end
-